
<!--
/**************************************************
* @ ordermanufactureview.jsp
*
* Copyright   2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/02/12, Jenny Li
*  1) first release
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page import="com.hitrust.gs.business.GSManufactureProcessor"%>
<%@ page import="com.hitrust.gs.bean.GSManufactureBean"%>
<%@ page import="com.hitrust.gs.bean.GSManufactureCategoryBean"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="java.util.HashMap"%>
<%@ include file="../../common.jsp" %>
<%@ taglib uri="/page.util.gs.hitrust.com/taglibs/page" prefix="page"%>
<html>
<head>
<title>产品浏览</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="<%=root%>/css/caigouxitong.css" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/string.js"></SCRIPT>
<%
    ArrayList tManuf1 = (ArrayList)request.getAttribute("manufacture1");
    HashMap tMap1 = (HashMap)request.getAttribute("manufacturetyp2");
    HashMap tMap2 = (HashMap)request.getAttribute("manufacturetyp3");
    
    ArrayList tList = new ArrayList();
    
    GSManufactureVO vo = (GSManufactureVO)session.getAttribute("QUERYCONDITION");
    ResultProcess tGSManuf = (ResultProcess)request.getAttribute("manufacture");
%>
<script language="JavaScript">
    var counter;
    function process(){
        manufactureform.iskeywordquery.value="F";
        manufactureform.action = "<%=response.encodeURL(root+"/A181105.do")%>";
        manufactureform.submit();
    }
    
    function processkey(){
        manufactureform.iskeywordquery.value="T";
        manufactureform.action = "<%=response.encodeURL(root+"/A181105.do")%>";
        manufactureform.submit();
    }
function change1(optval){
  var val = optval;
  if(val=='0'){
    var listbox = document.getElementById("manuftype2");
    listbox.length = 0;
    var option = new Option();
    option.text = "---二级---";
    option.value = "0";
    listbox.options[listbox.length] = option;
    change2(optval);
  }else{
      var counter="0";
    <%if(tMap1 !=null){
      Collection tCollection = tMap1.keySet();
      Iterator tIterator = tCollection.iterator();
      while(tIterator.hasNext()){
        String tKey = (String)tIterator.next();
        tList = (ArrayList)tMap1.get(tKey);%>
        if(val == '<%=tKey%>'){
          counter = "1";
          var listbox = document.getElementById("manuftype2");
          listbox.length = 0;
          var option = new Option();
          option.value = "0";
          option.text = "---二级---";
          listbox.options[listbox.length] = option;
          <%
                for(int n=0;n<tList.size();n++){
                    GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tList.get(n);
                    String categoryId = tGSManufactureBean.getGs_manufacture_category_id();
                    String categoryName = tGSManufactureBean.getGs_manufacture_category_name();%>
                    var temp1 = '<%=categoryId%>';
                    var temp2 = '<%=categoryName%>';
                    var option = new Option();
                    option.value = temp1;
                    option.text = temp2;
                    listbox.options[listbox.length] = option;
           <%
                }
           %>
            change2('0');           
         }
         
    <%
        }
    %>
        if(counter == '0'){
          var listbox = document.getElementById("manuftype2");
          listbox.length = 0;
          var option = new Option();
          option.value = "0";
          option.text = "---二级---";
          listbox.options[listbox.length] = option;  
          change2('0');     
        }
    <%  
    }
    %>
   }
}
    function change2(optval){
      var val = optval;
      if(val=='0'){
        var listbox = document.getElementById("manuftype3");
        listbox.length = 0;
        var option = new Option();
        option.text = "---三级---";
        option.value = "0";
        listbox.options[listbox.length] = option;

      }else{
        var counter = "0";
        <%if(tMap2 !=null){
          Collection tCollection = tMap2.keySet();
          Iterator tIterator = tCollection.iterator();
          while(tIterator.hasNext()){
            String tKey = (String)tIterator.next();
            tList = (ArrayList)tMap2.get(tKey);%>
            if(val == '<%=tKey%>'){
              counter = "1";
              var listbox = document.getElementById("manuftype3");
              listbox.length = 0;
              var option = new Option();
              option.text = "---三级---";
              option.value = "0";
              listbox.options[listbox.length] = option;
              <%for(int n=0;n<tList.size();n++){
                GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tList.get(n);
                String categoryId = tGSManufactureBean.getGs_manufacture_category_id();
                String categoryName = tGSManufactureBean.getGs_manufacture_category_name();%>
                var temp1 = '<%=categoryId%>';
                var temp2 = '<%=categoryName%>';
                var option = new Option();
                option.value = temp1;
                option.text = temp2;
                listbox.options[listbox.length] = option;
                <%}%>
              }
          <%
          }
          %>
          if(counter == '0'){
                var listbox = document.getElementById("manuftype3");
                listbox.length = 0;
                var option = new Option();
                option.text = "---三级---";
                option.value = "0";
                listbox.options[listbox.length] = option;          
          }
          <%
            }%>
          }
        }   
    
    function openwin(value){
        showModalDialog("<%=response.encodeURL(root+"/jsp/showimage.jsp")%>?path="+value,window,"status:no,unadorned:yes,dialogWidth:375px,dialogHeight:400px,help:no");
    } 
    function writeback(){
        var currentrownum = opener.document.getElementById('currentrownum').value;
        var checkboxvalue = document.getElementsByName("ckbox");
        var selectnum = 0;
        currentrownum=parseInt(currentrownum)+1;
        for(i=0;i<checkboxvalue.length;i++){
            if(checkboxvalue[i].checked){
                currentrownum ++;
                opener.location="javascript:addtablerow()";
                var tmp = checkboxvalue[i].value;
                var code_name = tokenize(tmp,"|");
                var lastRow = opener.document.getElementsByName("checkItem").length-1;
                opener.document.getElementsByName("divsdetailmanid"  )[lastRow].innerText=code_name[0];
                opener.document.getElementsByName("sdetailmanid"     )[lastRow].value=code_name[0];
                opener.document.getElementsByName("sdetailconid"     )[lastRow].value=code_name[1];
                opener.document.getElementsByName("divsdetailmanname")[lastRow].innerHTML=code_name[2]+"&nbsp;";
                opener.document.getElementsByName("sdetailmanname"   )[lastRow].value=code_name[2];
                opener.document.getElementsByName("sdetailproid"     )[lastRow].value=code_name[3];
                opener.document.getElementsByName("sdetailmantype"   )[lastRow].value=code_name[4];
                opener.document.getElementsByName("sdetailunit"      )[lastRow].value=code_name[7];
                opener.document.getElementsByName("div1"             )[lastRow].innerText=code_name[7];
                opener.document.getElementsByName("sdetailcount"     )[lastRow].value="1";
                opener.document.getElementsByName("divsdetailsum"    )[lastRow].innerText=code_name[7];
                opener.document.getElementsByName("sdetailsum"       )[lastRow].value=code_name[7];
                opener.document.getElementsByName("sdetailcatid"     )[lastRow].value=code_name[8];
                opener.document.getElementsByName("divproname"       )[lastRow].innerHTML=code_name[9]+"&nbsp;";
                opener.document.getElementsByName("mode"             )[lastRow].value=code_name[10];
                opener.document.getElementsByName("divmode"          )[lastRow].innerHTML=code_name[11];
                selectnum++;
            }
        }
        if(selectnum==0){
            alert("请至少选择一个集中编码");return false;
        }
        var row=opener.document.getElementById('currentrownum').value;
        var num=parseInt(row)+selectnum;
        opener.document.getElementById('currentrownum').value=num;
        opener.location="javascript:sumtotal()";
        window.close();     
    }
    function cls(){
        document.all.manuftype1.options[0].selected = true;
        document.all.manuftype2.options[0].selected = true;
        document.all.manuftype3.options[0].selected = true;
        document.all.concentricityId.value = "";
        document.all.manufactureName.value = "";
        document.all.manufactureSpec.value = "";
        document.all.manufactureType.value = "";
        document.all.manufactureBrand.value = "";
        document.all.manufacturerName.value = "";
        document.all.balancemode.value = "";
    }
</script>
</head>
<body BGCOLOR="#f5f5f5" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<p><br></p>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="20"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="1">
        <tr height="20">
          <td height="20" width="1" class="mtxt_black">&nbsp;</td>
          <td height="30" width="758" class="mtxt_black">产品查询</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bg_line" height="2"></td>
  </tr>
</table>

<br>


<form name="manufactureform" method="get" >
 <input type='hidden' name='iskeywordquery' value="<%=request.getParameter("iskeywordquery") %>">
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr> 
        <td> 
            <table class=bg_table id=tableId    cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
                
                <TR height=20>
                    <TD class="bg_column" align=center>产品分类</TD>
                    <TD left=right class="bg_row_odd" colspan=3>
                        <select name="manuftype1" onChange="change1(this.value)">   
                        <option value="0">---一级---</option>             
                        <%
                            String tManufType1 = vo==null?"":vo.gs_manufacture_category1;
                            //int iManuType1 = 0;
                            if(tManuf1 != null && tManuf1.size() > 0 ){
                                if(tManufType1 != null){
                                    //iManuType1 = Integer.parseInt(tManufType1);
                                }
                                for(int i=0; i<tManuf1.size(); i++){
                                    GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tManuf1.get(i);
                                    if(tManufType1!=null && tManufType1.equals(tGSManufactureBean.getGs_manufacture_category_id())){
                                        
                        %>
                                <option value="<%=tGSManufactureBean.getGs_manufacture_category_id()%>" selected>
                                <%=tGSManufactureBean.getGs_manufacture_category_name()%></option>
                        <%                  
                                    }else{
                        %>
                                <option value="<%=tGSManufactureBean.getGs_manufacture_category_id()%>">
                                <%=tGSManufactureBean.getGs_manufacture_category_name()%></option>
                                
                        <%          }   
                                }
                            }
                        %>

                        </select>
                        <select id="manuftype2" name="manuftype2" onChange="change2(this.value)">   
                        <option value="0">---二级---</option>             
                        <%
                            String tManufType2 = vo==null?"":vo.gs_manufacture_category2;
                            if(tManufType1 != null && !tManufType1.equals("0")){
                                //int tIntManuType2 = Integer.parseInt(tManufType2);
                                ArrayList temp = (ArrayList)tMap1.get(tManufType1);
                                if(temp != null ){
                                for(int i=0; i<temp.size(); i++){
                                    GSManufactureCategoryBean tGSManuf2 = (GSManufactureCategoryBean)temp.get(i);
                                    if(tManufType2!=null && tManufType2.equals(tGSManuf2.getGs_manufacture_category_id())){
                        %>
                                <option value="<%=tManufType2%>" selected><%=tGSManuf2.getGs_manufacture_category_name()%></option>
                        <%                  
                                    }else{
                        %>
                                <option value="<%=tGSManuf2.getGs_manufacture_category_id()%>"><%=tGSManuf2.getGs_manufacture_category_name()%></option>
                                
                        <%          }   
                                }
                                }
                            }
                        %>

                        </select>
                        <select name="manuftype3" id="manuftype3">  
                        <option value="0">---三级---</option>             
                        <%
                            String tManufType3 = vo==null?"":vo.gs_manufacture_category3;
                            if(tManufType2 != null && !tManufType2.equals("0") ){
                               // int tIntManufType3 = Integer.parseInt(tManufType3);
                                ArrayList temp = (ArrayList)tMap2.get(tManufType2);
                                if(temp != null ){
                                for(int i=0; i<temp.size(); i++){
                                    GSManufactureCategoryBean tGSManuf3 = (GSManufactureCategoryBean)temp.get(i);
                                    if(tManufType3!=null && tManufType3.equals(tGSManuf3.getGs_manufacture_category_id())){
                        %>
                                <option value="<%=tGSManuf3.getGs_manufacture_category_id()%>" selected><%=tGSManuf3.getGs_manufacture_category_name()%></option>
                        <%                  
                                    }else{
                        %>
                                <option value="<%=tGSManuf3.getGs_manufacture_category_id()%>"><%=tGSManuf3.getGs_manufacture_category_name()%></option>
                                
                        <%          }   
                                }
                                }
                            }
                        %>

                        </select>
                    </TD>                   
                </TR>
                <TR height=20>
                    <TD class="bg_column" align=center>集中编码</TD>
                    <TD align=left class="bg_row_odd" width="300"><input type="text" name="concentricityId" value="<%=vo==null? "":(vo.gs_concentricity_id==null?"":vo.gs_concentricity_id) %>"></TD>                   
                    <TD class="bg_column" align=center width="100">产品名称</TD>
                    <TD align=left class="bg_row_odd" ><input type="text" name="manufactureName" value="<%=vo==null? "":(vo.gs_manufacture_name==null?"":vo.gs_manufacture_name) %>"></TD>                  
                </TR>
                <TR height=20>
                    <TD class="bg_column" align=center>规格</TD>
                    <TD align=left class="bg_row_odd" width="300"><input type="text" name="manufactureSpec" value="<%=vo==null? "":(vo.gs_manufacture_spec==null?"":vo.gs_manufacture_spec) %>"></TD>                   
                    <TD class="bg_column" align=center width="100">型号</TD>
                    <TD align=left class="bg_row_odd" ><input type="text" name="manufactureType" value="<%=vo==null? "":(vo.gs_manufacture_type==null?"":vo.gs_manufacture_type) %>"></TD>                  
                </TR>
                <TR height=20>
                    <TD class="bg_column" align=center>品牌</TD>
                    <TD align=left class="bg_row_odd" width="300"><input type="text" name="manufactureBrand" value="<%=vo==null? "":(vo.gs_manufacture_brand==null?"":vo.gs_manufacture_brand) %>"></TD>                    
                    <TD class="bg_column" align=center width="100">生产厂商</TD>
                    <TD align=left class="bg_row_odd" ><input type="text" name="manufacturerName" value="<%=vo==null? "":(vo.gs_manufacturer_name==null?"":vo.gs_manufacturer_name) %>"></TD>                   
                </TR>
                <TR height=20>
                    <td class="bg_column" align=center>结算模式</td>
                  <td align=left class="bg_row_odd">
                  <select name="balancemode">
                    <option value="" selected>---全部---</option>
                    <%String mode =request.getParameter("balancemode")==null?"":request.getParameter("balancemode") ;
                    if(mode==null){%>
                        <option value="<%=GSBaseConstants.BALANCE_MODE1 %>"><%=DefineDic.getBalanceMode(GSBaseConstants.BALANCE_MODE1) %></option>
                        <option value="<%=GSBaseConstants.BALANCE_MODE2 %>"><%=DefineDic.getBalanceMode(GSBaseConstants.BALANCE_MODE2) %></option>
                    <%}else{
                    
                    String[][] stocksstate = GSBaseManager.getbalancemode();
                    if(stocksstate != null && stocksstate.length > 0 ){
                    
                        for(int i=0; i<stocksstate.length; i++){
                                    String[] temp = stocksstate[i];
                                    if(mode != null && mode.equals(temp[0])){
                        %>
                                        <option value="<%=temp[0]%>" selected>
                                        <%=temp[1]%></option>
                        <%                  
                                    }else{
                        %>
                                        <option value="<%=temp[0]%>" >
                                        <%=temp[1]%></option>
                        <%          
                                    }
                                }
                            }
                        }
                        %>
                    
                  </select>
                  </td>                   
                    <TD class="bg_column" align=center></TD>
                    <TD align=left class="bg_row_odd" ></TD>                   
                </TR>
            </table>
        </td>
    </tr>
</table>

    <p align="center">  
        <input type="button" class="kuang" width="58" height="24" value="查询" onclick="process()"/>&nbsp;
        <input type="button" class="kuang" width="58" height="24" value="清空" onclick='cls()'/>&nbsp;
    </p>
    
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr> 
        <td> 
            <table class=bg_table id=tableId    cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
                <TR height=20>
                    <TD class="bg_column" align=center width="110">关键字</TD>
                    <TD align=left class="bg_row_odd" width="100"><input type="text" name="keyword" value="<%=request.getParameter("keyword")==null?"":request.getParameter("keyword")%>"></TD> 
                    <TD class="bg_column" align=center colspan=2>
                        <input type="button" class="kuang" value='查询' onclick="processkey()"/>&nbsp;
                        <font color='red'>（对产品名称、型号、规格、品牌、生产厂商、附加属性等六个关键字的模糊查询）</font>
                    </TD>
                </TR>

            </table>
        </td>
    </tr>
</table>
    <%if(tGSManuf != null){
        int totalRecords = 0;
        if(request.getAttribute("totalRecords")!=null){
            totalRecords=Integer.parseInt((String)request.getAttribute("totalRecords"));
        }
        int defaultPageSize =10;
        if(request.getAttribute("pageSize")!=null){
            defaultPageSize=Integer.parseInt((String)request.getAttribute("pageSize"));
        }
            %>          
            <page:pager total='<%=totalRecords%>' defaultPageSize='<%=defaultPageSize%>'></page:pager>
            <%} %>
</form>
<%
    
    if(tGSManuf != null){
%>
    <center>
    <table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
        <tr>
            <td>
            <form name='pager' method="post">
                <input type='hidden' name='fanye' value='T'>
                <table class=bg_table id=tableId    cellspacing=1 cellpadding=2 width=100% align=center border=0>
                    <tbody> 
                    <tr class="bg_column" height=20>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">&nbsp;</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">产品编号</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">集中编码</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">产品名称</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">产品规格</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">产品型号</div>
                        </td>                                                                                                                                               
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">单位</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">产品品牌</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">生产厂商</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">供应商</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">结算模式</div>
                        </td>
                        <td class=top align=middle> 
                        <div align="center" class="txt_content">详细信息</div>
                        </td>                                                                                         
                    </tr>
                    <%
                        tList = tGSManuf.getAllRecoreds();
                        if(tList != null && tList.size() > 0){
                        for(int i=0; i<tList.size(); i++){
                            String[] tStr = (String[])tList.get(i);
                            String tTempStr="";
                            if(i%2==0){
                                tTempStr="class=\"bg_row_odd\"";
                            }else {
                                tTempStr="class=\"bg_row_even\"";
                            }
                    %>
                            <tr <%=tTempStr%> height=20>
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <input type='checkbox' name='ckbox' value='<%=tStr[0]+"|"+tStr[1]+"|"+tStr[2]+"|"+tStr[12]+"|"+tStr[6]+"|"+tStr[9]+"|"+tStr[4]+"|"+tStr[10]+"|"+tStr[13]+"|"+tStr[14]+"|"+tStr[15]+"|"+DefineDic.getBalanceMode(tStr[15])+"|"%>'>
                                    </div>
                                </td>   
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[0]%>
                                    </div>
                                </td>
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[1]%>
                                    </div>
                                </td>   
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <a href="<%=response.encodeURL(root+"/A100104.do")%>?concentricityId=<%=tStr[1]%>" target="_blank"><%=tStr[2]%></a>
                                    </div>
                                </td>                               
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[7]%>
                                    </div>
                                </td>
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[6]%>
                                    </div>
                                </td>                               
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[9]%>
                                    </div>
                                </td>                               
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[4]%>
                                    </div>
                                </td>       
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=tStr[5]%>
                                    </div>
                                </td>
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <a href="<%=response.encodeURL(root+"/A150504.do")%>?providerId=<%=tStr[12]%>" target="_blank"><%=tStr[14]%></a>
                                    </div>
                                </td> 
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <%=DefineDic.getBalanceMode(tStr[15])%>
                                    </div>
                                </td>                                              
                                <td class=top align=middle> 
                                    <div align="center" class="txt_content">
                                    <a href="<%=response.encodeURL(root+"/A100104.do")%>?concentricityId=<%=tStr[1]%>" target="_blank">详细</a>
                                    </div>
                                </td>                                                                   
                            </tr> 
                            
                    <%  
                            }
                    %>
                          <tr class="bg_column" height=20>
                            <td width="960" height="16" colspan="12" align="right">
                                    <!--导航条-->
                                    <page:navigator type='text' queryForm="manufactureform"/>
                            </td>
                          </tr>
                    <%
                        }else{
                    %>
                            <font color="red">没有符合条件的产品信息,请重新输入查询条件</font>
                    <%
                        }
                    %>
                    </tbody>
                </table>
                </form>                     
            </td>
        </tr>
    </table>
    </center>
    
<p>
<center>
<input type="button" class="kuang" value="确定" onclick="javascript:writeback();return false;">
<input type="button" class="kuang" value="返回" onclick="javascript:window.close();">
</center>
</p>    
<%      
    }
%>


</body>
</html>